using GameFrameWork;
using UnityEditor;

[CustomEditor(typeof(UIBaseMesh), true)]
class UIBaseMeshInspector : Editor
{
    protected SerializedProperty _script;

    protected virtual void OnEnable()
    {
        _script = serializedObject.FindProperty("m_Script");
    }

    protected virtual void OnDisable()
    {
        Tools.hidden = false;
    }


    void DrawInspector()
    {
        EditorGUILayout.BeginVertical("HelpBox");
        {
            EditorGUI.indentLevel++;
            DrawBaseInfo();
            EditorGUI.indentLevel--;
            EditorGUILayout.EndVertical();
        }

        EditorGUILayout.Space(5);

        OnDraw();
    }

    void DrawBaseInfo()
    {
        EditorGUI.BeginDisabledGroup(true);
        EditorGUILayout.PropertyField(_script);
        EditorGUI.EndDisabledGroup();
    }

    public sealed override void OnInspectorGUI()
    {
        serializedObject.Update();
        DrawInspector();
        serializedObject.ApplyModifiedProperties();
    }
    protected virtual void OnDraw() { }
}
